package xyz.jcat.leaf;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.jcat.common.exception.SystemException;

@Component
public class LeafIdWorker {

    @Autowired
    private SegmentService segmentService;

    public Long nextId(String key) {
        try {
            return segmentService.getId(key);
        }catch (Exception e) {
            throw new SystemException("美团leaf segment获取id异常", e);
        }
    }
}
